package top.malaoshi.ctrl;


import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.malaoshi.entity.Comment;
import top.malaoshi.model.Result;
import top.malaoshi.service.CommentSrvImpl;

import javax.annotation.Resource;

import java.util.List;


@RestController
@RequestMapping("/comment")
public class CommentCtrl {
    @Resource
    private CommentSrvImpl srv;
    @RequestMapping("queryByGoodsId")
    public Result queryByGoodsId(String goodsId){
        Result<List> res=new Result<>();
        if(goodsId==null || "".equals(goodsId)){
            res.setCode(100);
            res.setMsg("请输入要查询的ID！");
            return res;
        }
        List<Comment> list=srv.queryByGoodsId(goodsId);
        res.setCode(0);
        res.setData(list);

        return res;
    }
}